<template>
  <div class="friend-links">
    <h3 class="links-title">
      <i class="iconfont icon-link"></i> 友情链接
    </h3>
    <div class="links-container">
      <a 
        v-for="link in links" 
        :key="link.id"
        :href="link.url" 
        target="_blank"
        rel="noopener noreferrer"
        class="link-item"
      >
        <img 
          v-if="link.logo" 
          :src="link.logo" 
          :alt="link.name"
          class="link-logo"
        >
        <span v-else class="link-text">{{ link.name }}</span>
      </a>
    </div>
  </div>
</template>

<script>
export default {
  name: 'FriendLinks',
  props: {
    links: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style scoped>
.friend-links {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.links-title {
  font-size: 18px;
  margin: 0 0 15px;
  color: #333;
  display: flex;
  align-items: center;
}

.links-title i {
  margin-right: 8px;
  color: #67C23A;
}

.links-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-item {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  background: #f5f7fa;
  border-radius: 4px;
  text-decoration: none;
  color: #666;
  transition: all 0.3s;
}

.link-item:hover {
  background: #409EFF;
  color: #fff;
  transform: translateY(-2px);
}

.link-logo {
  height: 20px;
  max-width: 100px;
  object-fit: contain;
}

.link-text {
  font-size: 14px;
}

@media (max-width: 576px) {
  .links-container {
    justify-content: center;
  }
}
</style>